package SwordOffer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Sword_Offer_06 {

    public int[] reversePrint(ListNode head) {
        int i = 10000;
        int[] array = new int[10001];
        while (head != null) {
            array[i--] = head.val;
            head = head.next;
        }
        int length = 10000 - i;
        int[] res = new int[length];
        System.arraycopy(array, i + 1, res, 0, length);
        return res;
    }

    class ListNode {
        int val;
        ListNode next;
        ListNode(int x) { val = x; }
    }
}


